function createRequestObject(){
	var tmpXMLHttpObject;
	
	//depending on what the browser supports...
	if (window.XMLHttpRequest){
		//Mozilla, Safari
		tmpXMLHttpObject = new XMLHttpRequest();
	} else if (window.ActiveXObject) {
		//IE 
		tmpXMLHttpObject = new ActiveXObject("Microsoft.XMLHTTP");
	}
	return tmpXmlHttpObject;
}

var http = createRequestObject();

function makeGetRequest(wordId){
	//make a connection to the server, specifying intention to make GET request
	http.open('get', 'definition.jsp?id=' + wordId);
	
	//assign handler for response
	http.onreadystatechange = processResponse;
	
	//send the request
	http.send(null);
}


function processPresponse(){
	//check if the response has been received from the server
	if(http.readyState == 4){
		//read and assign the response from the server
		var response = http.responseText;
		
		//parse response?  no
		
		//assign response to contents of <div> - careful that response isn't 404!!
		document.getElementById('description').innerHTML = response;
	}
}

